package reco.db.validation;

import reco.db.Constraint;

public class MinSizeConstraintFactory extends SimpleConstraintFactory implements StringConstraintFactory {

    private final int size;

    public MinSizeConstraintFactory(int constraintSize) {
        super(String.class);
        this.size = constraintSize;
    }

    @Override
    protected <T> Constraint<T> createConstraint() {
        @SuppressWarnings("unchecked")
        // we already now T is String
        final Constraint<T> constraint = (Constraint<T>) new MinSizeConstraint(this.size);

        return constraint;
    }
}
